package com.mc.lp.database.dao;

import java.io.Serializable;
import java.util.List;

import org.springframework.dao.DataAccessException;

import com.mc.lp.database.exception.ConcurrentAccessException;
import com.mc.lp.shared.vo.KeyValueMap;

public interface IGenericDAO<T, ID extends Serializable> extends Serializable {

	T findById(ID id) throws DataAccessException;
	
	T get(ID id) throws DataAccessException ;

	List<T> findAll() throws DataAccessException;

	void create(final T entity) throws DataAccessException;

	public T save(T entity) throws DataAccessException;

	T saveOrUpdate(T entity) throws DataAccessException, ConcurrentAccessException;

	void update(final T entity) throws DataAccessException, ConcurrentAccessException;

	void delete(final T entity) throws DataAccessException, ConcurrentAccessException;

	void deleteById(ID id) throws DataAccessException, ConcurrentAccessException;

	<E> List<T> findByProperty(String property, E param) throws DataAccessException;

	<E> List<T> findByProperties(KeyValueMap map) throws DataAccessException;

	/*
	 * TODO Some points to improvise 1. add exceptions 2. add merge, lock,
	 * flush, evict and saveOrupdate if required and More to Come
	 */

}
